
#ifndef __STRING_UTILS
#define __STRING_UTILS

#include <vector>
#include <stdarg.h>
#include <apr_tables.h>

class StringUtils
{
   public:
      static int safe_vscnprintf(char *buffer, const char *format, va_list argpntr);
      static int ReadFileToString(char **fstring, const char *filename, apr_pool_t *mp);
      static int WriteStringToFile(const char *fstring, const char *filename, apr_pool_t *mp);
      static char *mpprintf(apr_pool_t *mp, const char *format, ...);
      static char *mpprintf_va(apr_pool_t *mp, const char *format, va_list args);
      static char *varprintf(const char *format, ...);
      static char *varprintf_va(const char *format, va_list args);
      static void DestroyStringList(std::vector<char *> *strlist);
      static char *FlattenStringList(std::vector<char *> *strlist);
      static char *FlattenStringList(std::vector<char *> *strlist, const char *sep);
      static std::vector<char *> *TableToStringList(apr_table_t *ttable);
      static void AggressiveStringSanitiser(char *tstring);
      static char *IntersectCSL(const char *csl1, const char *csl2);
      static char *DifferenceCSL(const char *csl1, const char *csl2);
      static int qsort_strcmp_wrapper(const void *c1, const void *c2);
      static const char *expandMyHomeDirectoryTilde(const char *inputpath, apr_pool_t *mp);
      static int AreCapabilitiesAcceptable(char *capswork, char *capscompute);
};

#endif
